package com.example.tiptravel.presenter.home;

import com.example.tiptravel.entity.home.NearBy;
import com.example.tiptravel.model.ModelFactory;
import com.example.tiptravel.view.impl.home.NearbyView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by 45820 on 2016/11/9.
 */

public class NearByPresenter {
    private NearbyView nearbyView;

    public NearByPresenter(NearbyView nearbyView) {
        this.nearbyView = nearbyView;
    }

    public void getNearByData(Map<String,String> map){
        ModelFactory.getiHomeModel().getNearByData(map, new Subscriber<NearBy>() {
            @Override
            public void onCompleted() {
                nearbyView.onComplete();
            }

            @Override
            public void onError(Throwable e) {
                nearbyView.onFailure(e);
            }

            @Override
            public void onNext(NearBy nearBy) {
                nearbyView.onSuccess(nearBy);
            }
        });
    }
}
